<?php

class Am_Helpdesk_Grid_Admin extends Am_Helpdesk_Grid {

    public function initGridFields() {
        $this->addField(new Am_Grid_Field('ticket_mask', ___('Ticket#'), true, '', null, '10%'));
        $this->addField(new Am_Grid_Field('m_login', ___('User'), true, '', array($this, 'renderUser'), '20%'));
        $this->addField(new Am_Grid_Field('subject', ___('Subject'), true, '', array($this, 'renderSubject'), '25%'));
        $this->addField(new Am_Grid_Field('updated', ___('Updated'), true, '', array($this, 'renderTime'), '20%'));
        $this->addField(new Am_Grid_Field('status', ___('Status'), true, '', array($this, 'renderStatus'), '5%'));
        $this->addField(new Am_Grid_Field('msg_cnt', ___('Msg Cnt'), true, 'center', null, '5%'));

        $this->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'cbGetTrAttribs'));
    }

    public function initActions()
    {
        parent::initActions();
        $this->actionAdd(new Am_Grid_Action_Delete());
    }

    public function getStatusIconId($id, $record) {
        return ($id == 'awaiting' && $record->status == HelpdeskTicket::STATUS_AWAITING_ADMIN_RESPONSE ?
            $id . '-me' : $id);
    }
}